
package oreilly.command.control;

/**
 * 
 * Copyright: Copyright (c) 2002-2007<br>
 * Company: E885 有限公司
 * 
 * @author Eric Gau(gau168.gau@msa.hinet.net)
 * @version 1.0
 */
public class SimpleRemoteControl
{
	/**
	 * 模擬 command 槽, 如 電話按鈕
	 */
	private Command slot;

	/**
	 * defalut constructor
	 * 
	 */
	public SimpleRemoteControl()
	{
	}

	/**
	 * construtor
	 * 
	 * @param slot thie instance of the Command
	 */
	public SimpleRemoteControl( Command slot )
	{
		this.slot = slot;
	}

	/**
	 * 模擬電話按鈕, 按鈕啟動功能
	 */
	public void buttonWasPressed()
	{
		slot.execute();
	}

	/**
	 * 設定 command
	 * 
	 * @param slot
	 */
	public void setCommand( Command slot )
	{
		this.slot = slot;
	}

	/**
	 * 模擬電話按鈕, 按鈕復原功能
	 * 
	 */
	public void undo()
	{
		slot.undo();
	}
}
